public class Pthread_Demo2 {
    public static void main(String[] args) {
        TestRunnable tr = new TestRunnable();
        Thread t = new Thread(tr);
        t.start();
    }
}

class TestRunnable implements Runnable{
    @Override
    public void run() {
        int i=1;
        while (i>0){
            System.out.println("Hello World!");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
